<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript" src="./script/aui-slide.js"></script>


</head>

<body>
    <header class="index-header" style="padding-top:1.5rem; height:6.5rem;">
        <div class="index-header-l">
            <img src="./images/head-s.png">
        </div>
        <img class="logo" src="./images/logo.png">
        <div class="index-header-r">
            <span class="fa fa-bell-o"></span>
        </div>
        <div class="aui-clearfix"></div>
        <!-- 搜索begin -->
        <div class="index-search" tapmode onclick="search()">
            <label>
            <span class="aui-iconfont aui-icon-search"></span>
            <input type="text" placeholder="请输入商品名称">
        </label>
        </div>
        <!-- 搜索end -->
    </header>
    <div style="height:6.5rem;"></div>

    <!-- 图片轮播begin -->
    <!-- <img src="./images/banner.jpg" style="width:100%" /> -->

    </div>

    </div>
    <!-- 图片轮播end -->
    <!-- <ul class="index-1">
        <li>
            <img src="./images/index-1-1.png"> 品牌自营
        </li>
        <li>
            <img src="./images/index-1-2.png"> 精挑优选
        </li>
        <li>
            <img src="./images/index-1-3.png"> 正品保证
        </li>
        <li>
            <img src="./images/index-1-4.png"> 售后无忧
        </li>
    </ul> -->
    <div id='list'>


    </div>


    <div style="height:6.5rem;"></div>

    <!-- 图片轮播begin -->
    <!-- <img src="./images/banner.jpg" style="width:100%" /> -->
    <script type="text/template" id="template">

    <div id="aui-slide">

      <div class="aui-slide-wrap" >
        {{~it.data.slide_list:value:index}}
          <div class="aui-slide-node bg-dark">
            <img src="{{=value.image}}" />
          </div>
        {{~}}
      </div>
      <div class="aui-slide-page-wrap"><!--分页容器--></div>
    </div>


    </div>
    <!-- 图片轮播end -->
    <ul class="index-1">
        <li>
            <img src="./images/index-1-1.png"> 品牌自营
        </li>
        <li>
            <img src="./images/index-1-2.png"> 精挑优选
        </li>
        <li>
            <img src="./images/index-1-3.png"> 正品保证
        </li>
        <li>
            <img src="./images/index-1-4.png"> 售后无忧
        </li>
    </ul>

        <!-- 首页导航begin -->
        <ul class="index-menu">
            <li tapmode onclick="classify()">
                <img src="./images/index-menu-1.png">
                <p>全部分类</p>
            </li>
            <li tapmode onclick="classify()">
                <img src="./images/index-menu-2.png">
                <p>正品特卖</p>
            </li>
            <li tapmode onclick="classify()">
                <img src="./images/index-menu-3.png">
                <p>人气商品</p>
            </li>
            <li tapmode onclick="cart()">
                <img src="./images/index-menu-4.png">
                <p>购物车</p>
            </li>
        </ul>
        <!-- 首页导航end -->

        <!-- 首页优惠券begin -->
        <ul class="index-coupon">
            <li tapmode onclick="coupondetails()">
                <div class="index-coupon-t">
                    <dl>
                        <dt>
                    ￥
                    <span>20</span>
                </dt>
                        <dd>
                            满199使用
                            <p>优惠券</p>
                        </dd>
                    </dl>
                    <button type="button">立即领取</button>
                </div>
                <img src="./images/index-yhj.png">
            </li>
            <li tapmode onclick="coupondetails()">
                <div class="index-coupon-t">
                    <dl>
                        <dt>
                    ￥
                    <span>20</span>
                </dt>
                        <dd>
                            满199使用
                            <p>优惠券</p>
                        </dd>
                    </dl>
                    <button type="button">立即领取</button>
                </div>
                <img src="./images/index-yhj.png">
            </li>
            <li tapmode onclick="coupondetails()">
                <div class="index-coupon-t">
                    <dl>
                        <dt>
                    ￥
                    <span>20</span>
                </dt>
                        <dd>
                            满199使用
                            <p>优惠券</p>
                        </dd>
                    </dl>
                    <button type="button">立即领取</button>
                </div>
                <img src="./images/index-yhj.png">
            </li>
        </ul>
        <!-- 首页优惠券end -->
        <div class="index-2">
            <ul>
                {{~it.data.pos_list:value:index}} {{? index < 2}}
                <li tapmode onclick="goodsdetails({{=value.mall_id}})">
                    <dl>
                        {{? index == 0}}
                        <dt>明星单品</dt>
                        <dd>累计好评最高商品</dd>
                        {{??}}
                        <dt>销售冠军</dt>
                        <dd>累计销售数量稳居第一</dd>
                        {{?}}
                    </dl>
                    <img src="{{=value.image}}">

                    </li>
                    {{?}} {{~}}
            </ul>

            <ul>
                {{~it.data.pos_list:value:index}} {{? index >= 2}}
                <li tapmode onclick="goodsdetails({{=value.mall_id}})">
                    <dl>
                        {{? index == 2}}
                        <dt>收藏最高</dt>
                        <dd>累计收藏最高商品</dd>
                        {{?? index == 3}}
                        <dt>好评如潮</dt>
                        <dd>累计好评最高商品</dd>
                        {{??}}
                        <dt>明星单品</dt>
                        <dd>累计好评最高商品</dd>
                        {{?}}
                    </dl>
                    <img src="{{=value.image}}">
                </li>
                {{?}} {{~}}
            </ul>




        </div>

        <div class="index-gg">
            <img src="./images/index-gg1.jpg">
        </div>
        <div class="index-goods">
            <ul>
                {{~it.data.new_list:value:index}}
                <li tapmode onclick="goodsdetails({{=value.mall_id}})">
                   <img src="{{=value.image}}">

                  <dl>
                    <dt>{{=value.title}}</dt>
                    <dd>￥{{=value.sell_price}}<span>立即够买</span></dd>
                  </dl>
                </li>
                {{~}}

            </ul>
        </div>

        <div class="index-gg">
            <img src="./images/index-gg2.jpg">
        </div>

        <div class="index-goods">
            <ul>
                {{~it.data.hot_list:value:index}}
                <li tapmode onclick="goodsdetails({{=value.mall_id}})">
                   <img src="{{=value.image}}">
                  <dl>
                    <dt>{{=value.title}}</dt>
                    <dd>￥{{=value.sell_price}}<span>立即够买</span></dd>
                  </dl>
                </li>
                {{~}}
            </ul>
        </div>
    </script>


</body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript">
    apiready = function() {

        getData();

    }

    function getData() {
        var userid = $api.getStorage('userid');
        var authtoken = $api.getStorage('authtoken');
        api.ajax({
            url: webAddress + '/a',
            method: 'get',
            headers: {
                TOKEN: token,
                authuid: userid,
                authtoken: authtoken
            }
        }, function(ret, err) {
            if (ret) {
                // console.log(JSON.stringify(ret));
                // data = ret.result;
                var template = $api.byId('template');
                var dotFn = doT.template(template.innerHTML);
                var html = dotFn(ret.result);
                var list = $api.byId('list');
                $api.html(list, html);
                // check_detail(0);


                var slide = new auiSlide({
                    container:document.getElementById("aui-slide"),
                    //"width":300, //宽度
                    "height":180, //高度
                    "speed":500, //速度
                    "autoPlay": 3000, //自动播放
                    "loop":true,//是否循环
                    "pageShow":true,//是否显示分页器
                    "pageStyle":'dot', //分页器样式，分dot,line
                    'dotPosition':'center', //当分页器样式为dot时控制分页器位置，left,center,right
                    // currentPage:currentFun
                })

            } else {
                alert(JSON.stringify(err));
            }
        });

    }

    function openClub() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'club_win',
            url: './html/index_frm.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };


    function search() {
        var delay = 0;
        if (api.systemType != 'ios') {
            delay = 300;
        }
        api.openWin({
            name: 'search',
            url: './search.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    function classify() {
        var delay = 0;
        if (api.systemType != 'ios') {
            delay = 300;
        }
        api.openWin({
            name: 'syclassify',
            url: './syclassify.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    function goodslist() {
        var delay = 0;
        if (api.systemType != 'ios') {
            delay = 300;
        }
        api.openWin({
            name: 'goodslist',
            url: './goods-list.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    function cart() {
        var delay = 0;
        if (api.systemType != 'ios') {
            delay = 300;
        }
        api.openWin({
            name: 'sycart',
            url: './sycart.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    }

    function distribution() {
        var delay = 0;
        if (api.systemType != 'ios') {
            delay = 300;
        }
        api.openWin({
            name: 'distribution',
            url: './distribution.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    }

    function userindex() {
        var delay = 0;
        if (api.systemType != 'ios') {
            delay = 300;
        }
        api.openWin({
            name: 'userindex',
            url: './user-index.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    function goodsdetails(index) {
        var delay = 0;
        if (api.systemType != 'ios') {
            delay = 300;
        }
        api.openWin({
            name: 'goods_details',
            url: './goods_details.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            pageParam: {
                id: index
            }
        });
    };

    function coupondetails() {
        var delay = 0;
        if (api.systemType != 'ios') {
            delay = 300;
        }
        api.openWin({
            name: 'coupon',
            url: './coupon.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    function closeWin() {
        api.closeWin({});
    }
</script>

</html>
